Build fixes on mbedtls and mqttc for CMake#3444
Build fixes on mbedtls and mqttc for CMake#3444fdcavalcanti wants to merge 2 commits intoapache:masterfrom
Conversation
Add mbedtls dependecy and fix patch path. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
cederom
left a comment
There was a problem hiding this comment.
Thank you @fdcavalcanti :-)
|
I see CI is complaining about the change, I'll investigate. |
|
@fdcavalcanti marked as a draft |
cederom
left a comment
There was a problem hiding this comment.
Just to note build fixes required :-)
f221d6f to
1def0a5
Compare
Expose include paths as public when using CMake. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
1def0a5 to
ae8dd4a
Compare
acassis
left a comment
There was a problem hiding this comment.
@fdcavalcanti nice work! Please update mqttc documentation (https://nuttx.apache.org/docs/latest/applications/examples/mqttc/index.html) to include info about how to use it with mbedtls.
Sorry but my changes did not affect any build process. |
Summary
Expose include paths as public when using CMake.
Add mbedtls dependecy and fix patch path.
Apps mbedtls no longer appends its include directories to the global nuttx target (NUTTX_INCLUDE_DIRECTORIES / NUTTX_CXX_INCLUDE_DIRECTORIES). That global injection caused arch/vendor code (e.g. Espressif tf-psa-crypto) to pick up headers from
nuttx-apps/crypto/mbedtls/mbedtls/include, which mixed two incompatible Mbed TLS trees and led to PSA/config include errors.The post-FetchContent patch step used
$(MQTTC_DIR)insidesh -c, which the shell treats as command substitution, not a CMake path. Replaced with a directpatch -d ${MQTTC_DIR} -p1 -i… invocation.With mbedtls includes no longer global, MQTT-C with mbedtls wires
nuttx_add_dependencies(TARGET mqttc DEPENDS mbedtls)when bothCONFIG_NETUTILS_MQTTC_WITH_MBEDTLSandCONFIG_CRYPTO_MBEDTLSare set, andmqttc_mbedtls_publists mbedtls in DEPENDS so the example compiles against the same headers as the library.This fixes build issues for Espressif devices whenever mbedtls was added (affecting CMake support only).
Impact
Impact on user: No.
Impact on build: Make builds are unaffected.
Anything that included
<mbedtls/...>only because of those global includes, and does not get headers via:could fail to compile until it gains an explicit dependency or include path. That is not vendor-specific; it depends on how each app’s CMakeLists.txt was written.
Impact on hardware: No.
Impact on documentation: No.
Impact on security: No.
Impact on compatibility: No.
Testing
Building
CMake build for
esp32c3-devkit:wifi.Append the following:
Results
CMake build would fail for this scenario, but works after the changes.